home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include "gl.h"
-
- #include "geom.h"
- #include "class.h"
- #include "classIds.h"
- #include "selectors.h"
- #include "mbox.h"
- #include "individual.h"
- #include "colors.h"
-
- extern class mboxClass;
-
- extern char *replicateModel(), *serviceTic(), *moveUp(), *drawIndividual();
- extern char *freeIndividual(), *selectIndiv(), *deselectIndiv();
- extern char *bselIndividual(), *cselIndividual();
- extern char *eselIndividual(), *oselIndividual(), *nselIndividual();
- extern char *postIndividual(), *dieIndividual(), *addPanel();
-
- fcnTable indivTable[] = {
- INIT, replicateModel, /* instantiate and initialize the model */
- DOIT, serviceTic, /* service the individual's tic, by servicing */
- /* each of its behaviors */
- MOVE, moveUp, /* advance to next position and heading */
- DRAW, drawIndividual, /* render the model description */
- FREE, freeIndividual, /* unsubscribe and gffree indiv & his pals */
- SELECT, selectIndiv, /* process selection of an individual */
- DESELECT, deselectIndiv, /* process deselection of an individual */
- BEGINSELECT,bselIndividual, /* begin picking on an individual */
- CONTSELECT, cselIndividual, /* continue picking on an individual */
- ENDSELECT, eselIndividual, /* end picking on an individual */
- OLDSELECT, oselIndividual, /* no longer picking on an individual */
- NEWSELECT, nselIndividual, /* continue picking on a new individual */
- ADDPANEL, addPanel, /* add a panel for the individual */
- POSTBEHAVE, postIndividual, /* post a behavior to an individual */
- DIE, dieIndividual,
- EOTABLE,
- };
-
- class indivClass = {
- &mboxClass,
- indivTable,
- sizeof(individual),
- INDIVIDUAL,
- };
-
- individual indivTemplate = {
- /* inst */
- &indivClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,0}, /* velocity */
- {0,0,0}, /* avelocity */
- {3,5,4}, /* acceleration */
- 1.0, /* speed */
- {3,4,5}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 0.0, /* scale */
- NULL, /* model */
- NULL, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- };
-
- point selectPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { 0, 000, 0, },
- { 10, 000, -30, },
- { 50, 000, -30, },
- { 25, 000, -50, },
- { 30, 000, -90, },
- { 0, 000, -70, },
- { -30, 000, -90, },
- { -25, 000, -50, },
- { -50, 000, -30, },
- { -10, 000, -30, },
- };
- /* null terminated polys, double null at end */
- long selectVertices[] = {
- 2,4,6,8,10,0,
- 2,3,4,0,
- 4,5,6,0,
- 6,7,8,0,
- 8,9,10,0,
- 10,1,2,0,
- 2,1,10,0,
- 10,9,8,0,
- 8,7,6,0,
- 6,5,4,0,
- 4,3,2,0,
- 10,8,6,4,2,0,
- 0,
- };
-
- model selectModel = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- selectPoints, /* point dictionary */
- selectVertices, /* polygon descriptions */
- { 0,0,0}, /* centroid */
- SELECT_COLOR, /* color */
- SELECT_TEXTURE, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 750,0,200}, /* translation */
- {1.0,1.0,1.0}, /* scale */
- 0, /* declasse */
- };
-